const app = getApp();
const Util = require('../../utils/util.js');
Page({
  /**
   * 页面的初始数据
   */
  data: {
    goodsList: ''
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (e) {
    this.setData({
      start_date: e.start_date,
      end_date: e.end_date,
      live_number: e.live_number,
      keywords: e.keywords
    })
    this.goodsList();
  },
  goodsList: function () {
    var that = this;
    var start_date = that.data.start_date;
    console.info(start_date);
    var end_date = that.data.end_date;
    console.info(end_date);
    var live_number = that.data.live_number;
    var keywords = that.data.keywords;
    Util.getSearchList({
      start_date:start_date,
      end_date:end_date,
      live_number: live_number,
      keywords: keywords
    }, function (ret) {
      that.setData({
        goodsList: ret.data
      });
    })
  },
  goodsDetail: function (e) {
    console.info(e);
    var goods_id = e.currentTarget.dataset.id;
    wx.navigateTo({
      url: 'detail?goods_id=' + goods_id
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})